//
//  AXShoppingCartInvalidHeaderView.m
//  hwacdx
//
//  Created by hwacdx on 2019/5/4.
//  Copyright © 2019 hwacdx. All rights reserved.
//

#import "AXShoppingCartInvalidHeaderView.h"

@interface AXShoppingCartInvalidHeaderView()

@property (strong, nonatomic) UILabel *titleLabel;

@property (strong, nonatomic) UIButton *clearBtn;

@end

@implementation AXShoppingCartInvalidHeaderView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self createSubviews];
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)createSubviews{
    //titleLabel
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 100, 20)];
    self.titleLabel.text = @"失效商品";
    self.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:14];
    self.titleLabel.textColor = [UIColor blackColor];
    [self addSubview:self.titleLabel];
    
    //clearBtn
    CGFloat clearBtnWidth = 80;
    self.clearBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - clearBtnWidth, 0, clearBtnWidth, 40)];
    [self.clearBtn.titleLabel setFont:kFontPingFang12];
    [self.clearBtn setTitle:@"清空失效商品" forState:UIControlStateNormal];
    [self.clearBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    [self.clearBtn addTarget:self action:@selector(clearBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.clearBtn];
}

- (void)clearBtnAction{
    if (_delegate && [_delegate respondsToSelector:@selector(shoppingCartInvalidHeaderView_buttonAction)]) {
        [_delegate shoppingCartInvalidHeaderView_buttonAction];
    }
}

@end
